package com.hs.libs.mobile;

import com.hs.libs.BaseUITasks;
import org.apache.log4j.Logger;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;

import java.util.List;

/**
 * Android UI 自动化测试任务，app: com.appsflyer.androidsampleapp
 */
public class AndroidUITasks extends BaseUITasks {
    private static Logger logger = Logger.getLogger(AndroidUITasks.class);

    public static boolean isRecordEvenBtnExist(WebDriver driver) throws Exception {
        boolean result = false;
        List<WebElement> btnEles =
                findObjectsByXPath("//android.widget.Button[contains(@resource-id,'id/trackEventButton')]", driver);
        if (btnEles != null && btnEles.size() > 0) {
            result = true;
            logger.info("RecordEven 按钮元素可以被定位成功！");
        }

        return result;
    }
}
